<?php
class Default_Model_User extends Zend_Db_Table{
    
    protected static $_instance;
    
    /*
     * Retrieve singleton instance
     */
    public static function getInstance()
    {
        if (null === self::$_instance)
        {
            self::$_instance = new self();
        }
        return self::$_instance;
    }
    
    public function checkLoginUser($username,$password){
        try
        {
            $objDb = $this->getDefaultAdapter();
            // call sp
            $objStmt = $objDb->prepare('CALL `sp_checkLoginUser`(:p_username,:p_password);');

            $objStmt->bindParam('p_username', $username,PDO::PARAM_STR);
            $objStmt->bindParam('p_password', $password,PDO::PARAM_STR);

            //SQLT_CHR
            // execute
            $objStmt->execute();
            
            $result = $objStmt->fetch();

            // Close cursor
            $objStmt->closeCursor();

            // Release
            unset($objStmt);
            
            return $result;
            
        }
        catch (Exception $ex)
        {
            throw new Exception($ex->getMessage(), $ex->getCode());
        }
    }
}
?>
